<link type="text/css" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
<script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
<style type="text/css">

	.container-box{
		height: 100vh;
	}
	.bootstrap-headerbox{
		position: relative;
		height: 10%;
		background-color: #666;
	}
	.leftbox,.rightbox{
		float: left;
		width: 50%;
		height: 90%;
	}
	.leftbox{
		background-color: #888;
	}
	.rightbox{
		background-color: #999;
	}
</style>



<div class="container-box">
	<div class="bootstrap-headerbox">
		<!--框架的组件文档 "https://getbootstrap.net/docs/components/navbar/"-->
		<nav class="navbar navbar-expand-lg navbar-dark bg-dark" style="min-height: 100%">
			<a class="navbar-brand" href="#">
				系统名称
			</a>
			<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent">
				<span class="navbar-toggler-icon"></span>
			</button>

			<div class="collapse navbar-collapse" id="navbarSupportedContent">
				<ul class="navbar-nav mr-auto" >
					<li class="nav-item">
						<a class="nav-link active" href="#">菜单项1</a>
					</li>
					<li class="nav-item">
						<a class="nav-link" href="#">菜单项2</a>
					</li>
					<li class="nav-item dropdown">
						<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">菜单项3</a>
						<div class="dropdown-menu">
							<a class="dropdown-item" href="#">子菜单1</a>
							<a class="dropdown-item" href="#">子菜单2</a>
							<a class="dropdown-item" href="#">子菜单3</a>
							<a class="dropdown-item" href="#">子菜单4</a>
						</div>
					</li>
				</ul>
				<form class="form-inline">
					<input class="form-control mr-2" type="search" placeholder="搜索" aria-label="Search" style="width: 70%">
					<button class="btn btn-outline-light" type="submit" >搜索</button>
				</form>
			</div>
		</nav>
	</div>


	<!-- 左侧内容区域 -->
	<div class="leftbox">


	</div>


	<!-- 右侧内容区域 -->
	<div class="rightbox">


	</div>
</div>

<script type="text/javascript">
	//取得搜索栏的节点对象
	var seachValue=document.querySelector(".form-inline .form-control");
	//取得搜索按钮的节点对象
	var submit=document.querySelector(".form-inline button[type='submit']");
	//点击搜索按钮触发
	submit.onclick=function(event){
		var event=event||window.event;
		event.preventDefault();//取消默认行为
		console.log('搜索按钮被触发');
		console.log(seachValue.value);//输出搜索框的值
	}
	//获取导航栏的点击项
	var navitem=$(".navbar-nav .nav-item");
	navitem.click(function(){
		console.log($(this).index());
		//利用addClass()、removeClass()来控制当前点击项的样式。
		//siblings()可获取当前点击项的其他兄弟元素
		//$(this).children('a').addClass('active')
		//$(this).siblings().children('a').removeClass('active');
	});
</script>

